package com.zys.controller;

import com.zys.entity.Result;
import com.zys.service.MenuService;
import com.zys.constant.MessageConstant;

import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 处理菜单相关操作
 */
@RestController
@RequestMapping("/menu")
public class MenuController {

  @Reference
  private MenuService menuService;

  /**
   * 获取菜单列表
   *
   * @return Result
   */
  @RequestMapping("/getMenuList")
  public Result getMenuList() {
    try {
      return new Result(true, MessageConstant.GET_MENU_LIST_SUCCESS, menuService.findAll());
    } catch (Exception e) {
      e.printStackTrace();
      return new Result(false, MessageConstant.GET_MENU_LIST_FAIL);
    }
  }
}
